package com.example;

import com.example.entity.User;
import com.example.service.UserService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Auther: ${USER}
 * @Date: ${YEAR}/${MONTH}/${DAY}/${TIME}
 * @Description:
 */
public class Main {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService service = context.getBean(UserService.class);
        User userById = service.getUserById(1);
        // 这里userById为null的原因，是因为这是前置通知，目标方法还未执行，所以没有返回值
        System.out.println("返回值是:"+userById);
    }
}